-
Notifications
You must be signed in to change notification settings - Fork 27.4k
refactor($compile): Create non-descriptive comments when debugInfoEnabled is false #14132
Conversation
Other than that it LGTM if you can make JSCS happy 😉 |
@@ -1508,6 +1508,14 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { | |||
safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope'); | |||
} : noop; | |||
|
|||
compile.$createComment = function(directiveName, comment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be $$createComment
(double $) like the other methods above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is $$createComment
then for sure we should not use it in ngMessagesInclude
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$$
is a good idea :)
Why not use it is ngMessagesInclude
then ? We use lots of $$
-private stuff in external modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm... ok, updated the PR
thought about it, but that would imply that it would need to check that this function is present... maybe not that bad |
External modules (such as So, |
…bled is false When debugInfoEnabled is `false` when comments generated by transclusions, ngIf, ngRepeat and ngSwitch will not contain any information about the directive nor the expression associated with it. Closes: angular#8722
but people are not that careful, and breaking things is always bad |
Letting ngMessages use $createComent is a good idea. We've made a similar change in 1.4.9 where some function where moved from ngAnimate to ng, which made both incompatible with other 1.4.x versions. This is expected and we should take advantage of it here. |
Refactor on generated comments used by
$compile
Comments contain the directive name and expression as part of their data.
When debugInfoEnabled is false, the comments will have empty
data
. When debugInfoEnabledis true, the current behavior is kept.
No
When debugInfoEnabled is
false
when comments generated by transclusions, ngIf,ngRepeat and ngSwitch will not contain any information about the directive nor
the expression associated with it.
Closes: #8722